home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_24451.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  36 lines

  1. -- card: 24451 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. "The address of" the variable 'amplitude' is assigned to f_ptr.  Finally, "that which is pointed to by" f_ptr (namely the value represented by amplitude) is halved and assigned back to amplitude.
  11.  
  12. Pointers are used frequently in C, mainly for two purposes:  informing a function of the location of data to be accessed and traversing arrays efficiently.  (Note that the former purpose essentially extends the scope* of the data.  Abuse of this may produce code which is difficult to understand and to maintain.)
  13.  
  14. A special pointer, the VOID POINTER will be useful later in this document.  The VOID data type is used mostly to declare the return value of functions whose return value is to be ignored.  Variables cannot be declared to have this type.  However, variables which are void pointers may be declared.  Such variables may be assigned pointers of ANY other type:
  15.  
  16.     float  f = 100.;
  17.     void  *v_ptr;
  18.     v_ptr = &f;
  19.  
  20.  
  21. -- part contents for background part 7
  22. ----- text -----
  23. 58
  24.  
  25. -- part contents for background part 29
  26. ----- text -----
  27. 20338
  28.  
  29.  
  30. -- part contents for background part 27
  31. ----- text -----
  32. Scope of variables
  33.  
  34. -- part contents for background part 20
  35. ----- text -----
  36. Scope of variables - p75